package leetcode.programmer;

import java.util.HashSet;

public class IsUnique {

    // AIP
    public boolean isUnique(String astr) {
        return astr.chars().distinct().count()==astr.length();
    }

    // set集合
    public boolean isUnique2(String astr) {
        HashSet<Character> set = new HashSet<>();
        for (char c : astr.toCharArray()) {
            set.add(c);
        }
        return set.size()==astr.length();
    }
}
